package com.iotp.service.online_exchange;

import com.iotp.dao.online_exchange.OnlineExchangeMapper;
import com.iotp.entity.online_exchange.OnlineExchange;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("onlineExchangeService")
public class OnlineExchangeServiceImpl implements OnlineExchangeService {
    @Autowired
    private OnlineExchangeMapper onlineExchangeMapper;
    @Override
    public Long add(OnlineExchange onlineExchange) {
        this.onlineExchangeMapper.insert(onlineExchange);
        return onlineExchange.getId();
    }

    @Override
    public void update(OnlineExchange onlineExchange) {
        this.onlineExchangeMapper.updateByPrimaryKeySelective(onlineExchange);
    }

    @Override
    public void delete(Long id) {
        this.onlineExchangeMapper.deleteByPrimaryKey(id);
    }

    @Override
    public OnlineExchange queryById(Long id) {
        return this.onlineExchangeMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<OnlineExchange> queryList(OnlineExchange onlineExchange) {
        return this.onlineExchangeMapper.selectByCondition(onlineExchange);
    }
}
